// VirtualBaseClass.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include <iostream.h>
class CMusic
{
public:
    CMusic() { cout << "Music default constructor" << endl; }

    virtual void listen() = 0;

    void sing() { cout << "Singing music" << endl; }

    ~CMusic() { cout << "Music default destructor" << endl; }
};

class CRockMusic : public CMusic
{
public:
    CRockMusic() {cout << "Rock music default constructor" << endl; }

    virtual void listen() { cout << "Listening rock music" << endl; }

    void sing() {cout << "Singing rock music" << endl; }

    ~CRockMusic() { cout << "Rock music default destructor" << endl; }
};

void main()
{
    CRockMusic rock_music;
    CMusic *p_music;

    rock_music.listen();
    rock_music.sing();

    p_music = &rock_music;

    p_music->listen();
    p_music->sing();
}